package com.example.text;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.text.Adapter.Recyler_Adapter;

import java.util.ArrayList;
import java.util.List;

public class Fragment_lxr extends Fragment {
    private RecyclerView recyclerView;
    private View view=null;
    List<mode_list> lists=null;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_lxr, container, false);
        initview();
        inifunction();
        return view;
    }
    private void initview() {
        recyclerView=view.findViewById(R.id.recylerview);
    }
    private void inifunction() {
        lists=new ArrayList<>();
       recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        Recyler_Adapter adapter=new Recyler_Adapter(lists);
        recyclerView.setAdapter(adapter);

        for (int i = 0; i < 10; i++) {
            lists.add(new mode_list(R.mipmap.ic_launcher_round,"标题"+i,"内容"+i));
        }
    }
}
